// JavaScript Document
$(function () {
    selector();


});

function selector() {
    var selected_img = "resources/images/slide-menu-page/selected.png";
    var unselected_img = "resources/images/slide-menu-page/unselected.png"
    var currentSelectedId = -1
    $(".template_select .template").each(function (index, element) {
        $(this).click(function () {
            currentSelectedId = index;
            $(".background").each(function (i) {
                if (i == index)
                    $(this).attr("src", selected_img);
                else
                    $(this).attr("src", unselected_img);
            });
        });

    });

    $("#apply").click(function(){
        if(currentSelectedId <= 0)
            alert("请选择一个模板");
        else{
            alert("已经选择id为：" + currentSelectedId);
        }
    });
}
